<?php

add_action('init','of_options');

if (!function_exists('of_options'))
{
	function of_options()
	{
		//Access the WordPress Categories via an Array
		$of_categories = array();  
		$of_categories_obj = get_categories('hide_empty=0');
		foreach ($of_categories_obj as $of_cat) {
		    $of_categories[$of_cat->cat_ID] = $of_cat->cat_name;}
		$categories_tmp = array_unshift($of_categories, "Select a category:");    
	       
		//Access the WordPress Pages via an Array
		$of_pages = array();
		$of_pages_obj = get_pages('sort_column=post_parent,menu_order');    
		foreach ($of_pages_obj as $of_page) {
		    $of_pages[$of_page->ID] = $of_page->post_name; }
		$of_pages_tmp = array_unshift($of_pages, "Select a page:");       
	
		//Testing 
		$of_options_select = array("one","two","three","four","five"); 
		$of_options_radio = array("one" => "One","two" => "Two","three" => "Three","four" => "Four","five" => "Five");

		/*-----------------------------------------------------------------------------------*/
		/* TO DO: Add options/functions that use these */
		/*-----------------------------------------------------------------------------------*/
		
		//More Options
		$uploads_arr = wp_upload_dir();
		$all_uploads_path = $uploads_arr['path'];
		$all_uploads = get_option('of_uploads');
		$other_entries = array("Select a number:","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19");
		$body_repeat = array("no-repeat","repeat-x","repeat-y","repeat");
		$body_pos = array("top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right");
		
		// Image Alignment radio box
		$of_options_thumb_align = array("alignleft" => "Left","alignright" => "Right","aligncenter" => "Center"); 
		
		// Image Links to Options
		$of_options_image_link_to = array("image" => "The Image","post" => "The Post"); 


/*-----------------------------------------------------------------------------------*/
/* The Options Array */
/*-----------------------------------------------------------------------------------*/

// Set the Options Array
global $of_options;
$of_options = array();

// General Settings
$of_options[] = array( "name" => "General Settings",
                    "type" => "heading");
					
$url =  ADMIN_DIR . 'assets/images/';
$of_options[] = array( "name" => "Main Layout",
					"desc" => "Select main content and sidebar alignment",
					"id" => "sidebar_position",
					"std" => "right",
					"type" => "images",
					"options" => array(
						'right' => $url . '2cr.png',
						'left' => $url . '2cl.png')
					);
					
$of_options[] = array( "name" => "Text Logo",
						"desc" => "Tick this box if you don't have an image based logo",
						"id" => "text_logo",
						"std" => "0",
						"type" => "checkbox");

$of_options[] = array( "name" => "Image Logo",
						"desc" => "Upload your logo here",
						"id" => "image_logo",
						"type" => "upload");
						
$of_options[] = array( "name" => "Display Search in Menu",
						"desc" => "Tick to display search icon in main menu",
						"id" => "display_menu_search",
						"std" => "1",
						"type" => "checkbox");

$of_options[] = array( "name" => "Favicon",
						"desc" => "Enter your Favicon URL e.g. http://website.com/favicon.ico",
						"id" => "favicon_url",
						"std" => "",
						"type" => "text");

$of_options[] = array( "name" => "Footer Message",
						"desc" => "Copyright message to be displayed in footer",
						"id" => "footer_msg",
						"std" => "&copy; Copyright 2013",
						"type" => "text");
						
$of_options[] = array( "name" => "Google Analytics Code",
					"desc" => "",
					"id" => "google-analytics",
					"std" => "",
					"type" => "textarea");

// Styling Options
$of_options[] = array( "name" => "Styling Options",
					"type" => "heading");


$of_options[] = array( "name" =>  "Body Background Colour",
						"desc" => "Pick a colour",
						"id" => "body_background",
						"std" => "",
						"type" => "color");
						
$of_options[] = array( "name" => "Background Image",
						"desc" => "Upload your background here",
						"id" => "body_background_image",
						"type" => "upload");
						
$of_options[] = array( "name" => "Background Repeat",
						"desc" => "Choose how to repeat the background image",
						"id" => "background_repeat",
						"std" => "repeat",
						"type" => "select",
						"options" => array(
							'repeat' => 'repeat',
							'repeat-y' => 'repeat-y',
							'repeat-x' => 'repeat-x',
							'no-repeat' => 'no-repeat',)
						);

$of_options[] = array( "name" =>  "Main Colour",
						"desc" => "Pick a colour",
						"id" => "main_color",
						"std" => "",
						"type" => "color");

$of_options[] = array( "name" =>  "Main Text Colour",
						"desc" => "Pick a colour",
						"id" => "main_text_color",
						"std" => "",
						"type" => "color");
						
$of_options[] = array( "name" =>  "Main Text Hover Colour",
						"desc" => "Pick a colour",
						"id" => "main_text_hover_color",
						"std" => "",
						"type" => "color");
						
$of_options[] = array( "name" =>  "Shop Highlight Colour",
						"desc" => 'Set the hover colour of the "Add to Cart", "Item Details" buttons',
						"id" => "shop_highlight",
						"std" => "",
						"type" => "color");
						
$of_options[] = array( "name" =>  "Mobile Search Field Background Colour",
						"desc" => '',
						"id" => "mobile_search_bg",
						"std" => "",
						"type" => "color");
						
$of_options[] = array( "name" =>  "Mobile Search Field Text Colour",
						"desc" => '',
						"id" => "mobile_search_text",
						"std" => "",
						"type" => "color");

$of_options[] = array( "name" => "Custom CSS",
					"desc" => "Add any custom CSS you wish here",
					"id" => "custom_css",
					"std" => '',
					"type" => "textarea");
										
$of_options[] = array( "name" => "Google Font",
					"desc" => "Add Google Font Code Here, e.g. <br /><br /> &#60;link href='http://fonts.googleapis.com/css?family=Cardo:400,400italic,700' rel='stylesheet' type='text/css'&#62;",
					"id" => "custom_font_code",
					"std" => "<link href='http://fonts.googleapis.com/css?family=Cardo:400,400italic,700' rel='stylesheet' type='text/css'>",
					"type" => "textarea");

$of_options[] = array( "name" => "Google Font Name",
					"desc" => "Enter the Google Font name / family here without 'font-family', e.g. <br /><br /> 'Cardo', serif",
					"id" => "custom_font",
					"std" => "'Cardo', serif",
					"type" => "text");

// Home Settings
$of_options[] = array( "name" => "Home Settings",
					"type" => "heading");
					
$of_options[] = array( "name" => "Slideshow: Display",
					"desc" => "Tick to display slideshow on homepage",
					"id" => "slideshow_display",
					"std" => "1",
					"type" => "checkbox");

$of_options[] = array( "name" => "Slideshow: Slide Limit",
					"desc" => "Enter a numerical value, e.g. 5",
					"id" => "slideshow_max_slides",
					"std" => "5",
					"type" => "text");

$of_options[] = array( "name" => "Slideshow: Category ID",
					"desc" => "Enter a news category ID, leave blank to show all",
					"id" => "slideshow_category",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "2 Large Columns: Display",
					"desc" => "Tick to display 2 large columns on homepage",
					"id" => "home2cols_display",
					"std" => "1",
					"type" => "checkbox");

$of_options[] = array( "name" => "2 Large Columns: Column 1 Category ID",
					"desc" => "Enter a news category ID, leave blank to show all",
					"id" => "home2cols_col1_cat",
					"std" => "",
					"type" => "text");
					
$of_options[] = array( "name" => "2 Large Columns: Column 2 Category ID",
					"desc" => "Enter a news category ID, leave blank to show all",
					"id" => "home2cols_col2_cat",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "5 Small Columns: Display",
					"desc" => "Tick to display 5 small columns on homepage",
					"id" => "home5cols_display",
					"std" => "1",
					"type" => "checkbox");

$of_options[] = array( "name" => "5 Small Columns: Category ID",
					"desc" => "Enter a news category ID, leave blank to show all",
					"id" => "home5cols_cat",
					"std" => "",
					"type" => "text");
					
$of_options[] = array( "name" => "5 Small Columns: Post Limit",
					"desc" => "Enter a numerical value, e.g. 5",
					"id" => "home5cols_limit",
					"std" => "5",
					"type" => "text");

$of_options[] = array( "name" => "2 Slideshow Columns: Display",
					"desc" => "Tick to display 2 slideshow columns on homepage",
					"id" => "home2cols_slide_display",
					"std" => "1",
					"type" => "checkbox");

$of_options[] = array( "name" => "2 Slideshow Columns: Column 1 Category ID",
					"desc" => "Enter a news category ID, leave blank to show all",
					"id" => "home2cols_slide_col1_cat",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "2 Slideshow Columns: Column 1 Post Limit",
					"desc" => "Enter a numerical value, e.g. 5",
					"id" => "home2cols_slide_col1_limit",
					"std" => "3",
					"type" => "text");

$of_options[] = array( "name" => "2 Slideshow Columns: Column 2 Category ID",
					"desc" => "Enter a news category ID, leave blank to show all",
					"id" => "home2cols_slide_col2_cat",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "2 Slideshow Columns: Column 2 Post Limit",
					"desc" => "Enter a numerical value, e.g. 5",
					"id" => "home2cols_slide_col2_limit",
					"std" => "3",
					"type" => "text");

$of_options[] = array( "name" => "Shop: Display",
					"desc" => "Tick to display shop items on homepage",
					"id" => "shop_display",
					"std" => "1",
					"type" => "checkbox");

$of_options[] = array( "name" => "Shop: Title",
					"desc" => "Enter a title to be displayed above the products",
					"id" => "homeshop_title",
					"std" => "Our Shop",
					"type" => "text");

$of_options[] = array( "name" => "Shop: Category Slug",
					"desc" => "Enter the shop category slug",
					"id" => "homeshop_category",
					"std" => "",
					"type" => "text");
					
$of_options[] = array( "name" => "Shop: Product Limit",
					"desc" => "Enter a numerical value, e.g. 8",
					"id" => "homeshop_per_page",
					"std" => "8",
					"type" => "text");

// News Settings
$of_options[] = array( "name" => "News Settings",
					"type" => "heading");

$of_options[] = array( "name" => "Category Page Style",
					"desc" => "",
					"id" => "category_page_style",
					"std" => "1",
					"type" => "select",
					"options" => array(
						'1' => 'One Column',
						'2' => 'Two Columns',)
					);

$of_options[] = array( "name" => "Display Sharing Options",
					"desc" => "Tick to display Tweet/Like/Pin links at bottom of each article",
					"id" => "display_sharing_options",
					"std" => "1",
					"type" => "checkbox");
					
$of_options[] = array( "name" => "Display Recommended",
					"desc" => "Tick to display recommend articles at bottom of each article",
					"id" => "display_recommended_articles",
					"std" => "1",
					"type" => "checkbox");

// Shop Settings
$of_options[] = array( "name" => "Shop Settings",
					"type" => "heading");

$of_options[] = array( "name" => "Shop Items Per Page",
					"desc" => "Enter a numerical value e.g. 10",
					"id" => "shop_per_page",
					"std" => "9",
					"type" => "text");
					
$of_options[] = array( "name" => "Shop Columns",
					"desc" => "Select how many columns you would like product pages to have",
					"id" => "shop_columns",
					"std" => "4",
					"type" => "select",
					"options" => array(
						'2' => '2',
						'3' => '3',
						'4' => '4',)
					);

$of_options[] = array( "name" => "Display Category",
					"desc" => "Display a list of categories a product belongs to on the product single page",
					"id" => "display_product_category",
					"std" => "1",
					"type" => "checkbox");

// Social Options	
$of_options[] = array( "name" => "Social Settings",
					"type" => "heading");

$of_options[] = array( "name" => "Twitter",
					"desc" => "URL with http://",
					"id" => "social_twitter",
					"std" => "",
					"type" => "text");
					
$of_options[] = array( "name" => "Pinterest",
					"desc" => "URL with http://",
					"id" => "social_pinterest",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Facebook",
					"desc" => "URL with http://",
					"id" => "social_facebook",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Googleplus",
					"desc" => "URL with http://",
					"id" => "social_googleplus",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Tumblr",
					"desc" => "URL with http://",
					"id" => "social_tumblr",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Vimeo",
					"desc" => "URL with http://",
					"id" => "social_vimeo",
					"std" => "",
					"type" => "text");					
					
$of_options[] = array( "name" => "Youtube",
					"desc" => "URL with http://",
					"id" => "social_youtube",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "RSS Feed",
					"desc" => "URL with http://",
					"id" => "social_rss",
					"std" => "",
					"type" => "text");	

$of_options[] = array( "name" => "Flickr",
					"desc" => "URL with http://",
					"id" => "social_flickr",
					"std" => "",
					"type" => "text");

// Contact Options
$of_options[] = array( "name" => "Contact Settings",
					"type" => "heading");

$of_options[] = array( "name" => "Contact Form Email",
					"desc" => "Enter the email address you would like the contact form to send emails to",
					"id" => "contact_email",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Street Address",
					"desc" => "To be display in contact details list",
					"id" => "street_address",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Phone Number",
					"desc" => "To be display in contact details list",
					"id" => "phone_number",
					"std" => "",
					"type" => "text");

$of_options[] = array( "name" => "Email Address",
					"desc" => "To be display in contact details list",
					"id" => "email_address",
					"std" => "",
					"type" => "text");
					
$of_options[] = array( "name" => 'Display Google Map On Contact Page',
					"desc" => 'Tick to display',
					"id" => "map_address",
					"std" => "1",
					"type" => "checkbox");
					
$of_options[] = array( "name" => "Google Map Address",
					"desc" => "",
					"id" => "gmap-address",
					"std" => "",
					"type" => "text");
					
$of_options[] = array( "name" => "Google Map Marker Content",
					"desc" => "",
					"id" => "gmap-content",
					"std" => "<h2>StyleMag</h2><p>1 Main Road, London, UK</p>",
					"type" => "textarea");
					
// Backup Options
$of_options[] = array( "name" => "Backup Options",
					"type" => "heading");
					
$of_options[] = array( "name" => "Backup and Restore Options",
                    "id" => "of_backup",
                    "std" => "",
                    "type" => "backup",
					"desc" => 'You can use the two buttons below to backup your current options, and then restore it back at a later time. This is useful if you want to experiment on the options but would like to keep the old settings in case you need it back.',
					);
					
$of_options[] = array( "name" => "Transfer Theme Options Data",
                    "id" => "of_transfer",
                    "std" => "",
                    "type" => "transfer",
					"desc" => 'You can tranfer the saved options data between different installs by copying the text inside the text box. To import data from another install, replace the data in the text box with the one from another install and click "Import Options".
						',
					);
					
	}
}
?>
